package com.woniu.tank.bullet;

import com.woniu.tank.boom.Boom;
import com.woniu.tank.tank.GoodTank;
import com.woniu.tank.ui.GamePanel;


public class BadBullet extends Bullet{
	
	
	//重写父类子弹,碰撞检测。敌方坦克打死玩家。
	@Override
	public void collision(int[][] map){
		super.collision(map);
		for(int i=0;i<GamePanel.gttank.size();i++){
			GoodTank good = GamePanel.gttank.get(i);
			if(good.x==x&&good.y==y){
				good.live=false;
				this.live=false;
				GamePanel.gttank.remove(i);
				GamePanel.gbbullet.remove(this);
				GamePanel.boomtk.add(new Boom(x,y, tc));
			}
		}
		//子弹与子弹碰撞
		for(int j=0;j<GamePanel.gbbullet.size();j++){
			GoodBullet gd = GamePanel.gbbullet.get(j);
			if(gd.x==x&&gd.y==y){
				gd.live = false;
				this.live= false;
				GamePanel.gbbullet.remove(j);
				GamePanel.bbullet.remove(this);				
			}			
		}		
	}
	public BadBullet() {
		super();
	}
	public BadBullet(int x, int y, int dir,GamePanel tc) {
		super(x, y, dir,tc);		
	}


}
